/*
 * Package: org.grassfield.common.entity
 * FileName: UserRole.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package bean;

import java.util.Set;

/**
 * The Class UserRole.
 */
public class UserRole {
	private Long id;
	private String name;
	private String emailPermission;
	private Set<MenuItem> menuList;
	
	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	
	/**
	 * Sets the id.
	 * 
	 * @param id the new id
	 */
	public void setId(Long id) {
		this.id = id;
	}
	
	/**
	 * Gets the name.
	 * 
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the name.
	 * 
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the menu list.
	 * 
	 * @return the menu list
	 */
	public Set<MenuItem> getMenuList() {
		return menuList;
	}

	/**
	 * Sets the menu list.
	 * 
	 * @param menuList the new menu list
	 */
	public void setMenuList(Set<MenuItem> menuList) {
		this.menuList = menuList;
	}

	/**
	 * Gets the email permission.
	 * 
	 * @return the email permission
	 */
	public String getEmailPermission() {
		return emailPermission;
	}

	/**
	 * Sets the email permission.
	 * 
	 * @param emailPermission
	 *            the new email permission
	 */
	public void setEmailPermission(String emailPermission) {
		this.emailPermission = emailPermission;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserRole other = (UserRole) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "UserRole [menuList=" + menuList + ", name=" + name + "]";
	}
	
}
